﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using cs_dame.Controler;

namespace cs_dame.View
{
    public partial class Preference : Form
    {
        private MainFrame o;
        private int Groesse;
        private SpielerTyp White;
        private SpielerTyp Red;

        public Preference(MainFrame o)
        {
            InitializeComponent();
            this.o = o;
            this.Groesse = o.Groesse;
            this.White = o.White;
            this.Red = o.Red;
        }

        private void Preference_Load(object sender, EventArgs e)
        {
            if (Groesse == 8)
            {
                radioButton1.Checked = true;
            }
            if (Groesse == 10)
            {
                radioButton2.Checked = true;
            }
            if (White == SpielerTyp.MENSCH)
            {
                radioButton3.Checked = true;
            }
            if (White == SpielerTyp.COMPUTER)
            {
                radioButton4.Checked = true;
            }
            if (Red == SpielerTyp.MENSCH)
            {
                radioButton5.Checked = true;
            }
            if (Red == SpielerTyp.COMPUTER)
            {
                radioButton6.Checked = true;
            }
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            Groesse = 8;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            Groesse = 10;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            o.Groesse = this.Groesse;
            o.White = this.White;
            o.Red = this.Red;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            White = SpielerTyp.MENSCH;
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            White = SpielerTyp.COMPUTER;
        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            Red = SpielerTyp.MENSCH;
        }

        private void radioButton6_CheckedChanged(object sender, EventArgs e)
        {
            Red = SpielerTyp.COMPUTER;
        }
    }
}
